Software developers use Application Programming Interfaces (APIs) oflibraries and frameworks extensively while writing programs. In this context,the recommendations provided in code completion pop-ups help developers choosethe desired methods. The candidate lists recommended by these tools, however,tend to be large, ordered alphabetically and sometimes even incomplete. A fairamount of work has been done recently to improve the relevance of these codecompletion results, especially for statically typed languages like Java.However, these proposed techniques rely on the static type of the object andare therefore inapplicable for a dynamically typed language like Python. Inthis paper, we present PyReco, an intelligent code completion system for Pythonwhich uses the mined API usages from open source repositories to order theresults based on relevance rather than the conventional alphabetic order. Torecommend suggestions that are relevant for a working context, a nearestneighbor classifier is used to identify the best matching usage among all theextracted usage patterns. To evaluate the effectiveness of our system, the codecompletion queries are automatically extracted from projects and testedquantitatively using a ten-fold cross validation technique. The evaluationshows that our approach outperforms the alphabetically ordered APIrecommendation systems in recommending APIs for standard, as well as,third-party libraries.
展开▼